<%@ page contentType="text/html;charset=UTF-8" trimDirectiveWhitespaces="true"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<c:set var="extLibs" value="grid"/>
<sys:header title="电量结算管理" extLibs="${extLibs}" />
<div id="importBox" class="hide">
	<form id="importForm" action="${ctx}/elec/elecCloseAccounts/import" method="post" enctype="multipart/form-data"
		  class="form-search" style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入，请稍等...');"><br/>
		<div class="form-group"><input id="uploadFile" name="file" type="file" style="width:350px"/><br/>
			<input id="btnImportSubmit" class=""  type="submit" value="   导    入   "/>
			<a href="${ctx}/elec/elecCloseAccounts/import/template">下载模板</a>
		</div>

	</form>
</div>
<div class="portlet box ${boxStyleColor}">
	<div class="portlet-title">
		<div class="caption"><i class="fa fa-coffee"></i> 电量结算管理</div>
		<div class="actions">
			<a href="#" class="btn btn-default btn-sm" id="btnSearch" title="查询"><i class="fa fa-search"></i> 查询</a>
			<shiro:hasPermission name="elec:elecCloseAccounts:edit">
				<a href="${ctx}/elec/elecCloseAccounts/form" class="btn btn-default btn-sm btnTool" title="新增电量结算"><i class="fa fa-plus"></i> 新增</a>
			</shiro:hasPermission>
			<a href="#" id="btnImport" class="btn btn-default btn-sm" title="导入"> <i class="fa fa-pencil-square-o"></i> 导入</a>

		</div>
	</div>
	<div class="portlet-body list">
		<form:form id="searchForm" modelAttribute="elecCloseAccounts" action="${ctx}/elec/elecCloseAccounts/listData" method="post" class="breadcrumb form-inline hide"
				data-page-no="${page.pageNo}" data-page-size="${page.pageSize}" data-order-by="${page.orderBy}">
			<div class="form-group">
				<label class="control-label">企业编码：</label>
				<div class="input-inline">
					<form:input path="brypeCode" htmlEscape="false" maxlength="64" class="form-control input-sm width-160"/>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label">企业名称：</label>
				<div class="input-inline">
					<form:input path="btypeNamee" htmlEscape="false" maxlength="64" class="form-control input-sm width-160"/>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label">手机号：</label>
				<div class="input-inline">
					<form:input path="tel" htmlEscape="false" maxlength="64" class="form-control input-sm width-160"/>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label">月份：</label>
				<div class="input-inline">
					<form:input path="month" htmlEscape="false" maxlength="64" class="form-control input-sm width-160"/>
				</div>
			</div>
			<div class="form-group" style="margin-left:10px;"> 
				<input class="btn btn-primary btn-sm" type="submit" value="查询"/>&nbsp;
				<input class="btn default btn-sm" type="reset" value="重置"/>
			</div>
		</form:form>
		<table id="dataGrid"></table>
		<div id="dataGridPage"></div>
	</div>
</div>
<sys:footer extLibs="${extLibs}" />
<script type="text/javascript">
	// 初始化DataGrid对象
	$("#dataGrid").dataGrid({
		
		searchForm: $("#searchForm"), // 数据来源表单
		tabPageId: '${param.tabPageId}',// 当前页签编号
		
		// 设置数据表格列
		columnModel: [
			{header:'企业编码', name:'brypeCode', index:'a.brype_code', width:100, align:"left", frozen:true},
			{header:'企业名称', name:'btypeNamee', index:'a.btype_namee', width:200, align:"left", formatter: function(val, obj, row, act){
					return '<a href="${ctx}/elec/elecCloseAccounts/form?id='+row.id+'" class="btnList" data-title="编辑电量结算">'+(val ? val : row.id)+'</a>';
				}},
			{header:'手机号', name:'tel', index:'a.tel', width:100, align:"center"},
			{header:'结算电量', name:'jsElectric', index:'a.js_electric', width:100, align:"right"},
			{header:'加权电价', name:'jqElectric', index:'a.jq_electric', width:100, align:"right"},
			{header:'标杆电价', name:'bgElectric', index:'a.bg_electric', width:100, align:"right"},
			{header:'收益', name:'earnings', index:'a.earnings', width:100, align:"right"},
			{header:'偏差率', name:'deviationRatio', index:'a.deviation_ratio', width:100, align:"right"},
			{header:'月份', name:'month', index:'a.month', width:100, align:"left"},
			{header:'操作', name:'actions', width:100, fixed:true, sortable:false, formatter: function(val, obj, row, act){
				var actions = [];//<shiro:hasPermission name="elec:elecCloseAccounts:edit">
				if (row.status == Global.STATUS_NORMAL){
					actions.push('<a href="${ctx}/elec/elecCloseAccounts/form?id='+row.id+'" class="btnList" title="编辑电量结算"><i class="fa fa-pencil"></i></a>&nbsp;');
					actions.push('<a href="${ctx}/elec/elecCloseAccounts/delete?id='+row.id+'" class="btnList" title="删除该电量结算" data-confirm="确认要删除该电量结算吗？"><i class="fa fa-trash-o"></i></a>&nbsp;');
				}//</shiro:hasPermission>
				return actions.join('');
			}}
		],
		ajaxSuccess: function(data){ // 加载成功后执行方法
			
		}
	});


	$("#btnImport").click(function(){
		$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true},
			bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
	});
</script>